GBML manual / Screen

screen_flash

Makes the whole picture that color AT ONCE, then fades it back to normal over so many frames, without changing room: screen_flash(COLOR_WHITE, 8) is a quick white hit flash. Use it when something is hurt, a lightning bolt strikes or a switch is thrown.

Works differently on Game Boy - The Game Boy has 4 shades, so a screen flash shows the shade closest to the color for a moment: black and white flash exactly, any other color flashes as its grey.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

screen_flash(color, frames)

Arguments

NameType
colorshape_color
framesint

Returns

Nothing.

Description

Makes the whole picture one color at once, then fades it back to normal over so many frames, without changing room. screen_flash(COLOR_WHITE, 8) is a quick white hit flash. Use it when something is hurt, lightning strikes, or a switch is thrown.

Example

if (btn_pressed(BTN_B)) {
    screen_flash(COLOR_WHITE, 8);
}

Pressing B flashes the screen white, and it clears over 8 frames.

The small print

Cost

One palette fade a frame while it fades, and nothing afterwards.

On the GBA

The color is there on the very frame you call it and fades away in a straight line; 60 frames is about a second, and 6 to 12 reads as a flash. frames of 0 or less does nothing visible. Calling it again before it is over starts a fresh flash. It is the same fade as screen_fade, so it shades the backgrounds and the sprites together.

See also: screen_fadescreen_fade_in